#include <stdio.h>

int main(int argc, char const *argv[])
{
    int i, n, input[128], sum = 0, age;
    int result = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &input[i]);
        sum += input[i];
    }
    age = sum / n;
    for (i = 0; i < n - 1; i++)
    {
        if (input[i] - age)
        {
            input[i+1] += input[i] - age;
            result++;
        }
    }
    printf("%d", result);
    return 0;
}
